﻿Imports Microsoft.VisualBasic
''' <summary>
''' Utilities for common page operations such as displaying errors.
''' </summary>
Public Class PageUtilities
    ''' <summary>
    ''' Create an error message and attach it to an existing web control.
    ''' </summary>
    ''' <param name="msg">A descriptive error message.</param>
    ''' <param name="WebCtrl">A web control to attach this error message to.</param>
    Public Shared Sub GenerateError(Of t As System.Web.UI.WebControls.WebControl)(ByVal msg As String, ByRef WebCtrl As t)
        Dim ErrorLabel As WebControls.Label = New WebControls.Label
        ErrorLabel.Text = msg
        ErrorLabel.Attributes.Add("class", "error")

        WebCtrl.Controls.Add(ErrorLabel)
    End Sub
End Class
